﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.EntityModel;
using System.Globalization;
using System.Runtime.Serialization;

namespace YasharEl.Infrastructure.ResourcesManagement
{
    [Serializable]
    public class ResourceNotFoundException : DomainModelException
    {
        #region ReadOnly Fields

        private readonly string resourceName;
        private readonly CultureInfo cultureInfo;

        #endregion

        #region Properties

        public string ResourceName
        {
            get { return resourceName; }
        }

        public CultureInfo Culture
        {
            get { return cultureInfo; }
        }

        #endregion

        #region Constructors

        public ResourceNotFoundException(string resourceName, CultureInfo cultureInfo)
            : base(string.Format("Resource with name {0} for culture {1} not found.", resourceName, cultureInfo == null ? "N/A" : cultureInfo.DisplayName))
        {
            this.resourceName = resourceName;
            this.cultureInfo = cultureInfo;
        }

        protected ResourceNotFoundException(SerializationInfo info, StreamingContext context) :
            base(info, context)
        {
        }

        #endregion
    }
}
